#include <iostream>

using namespace std;

bool f(int x)
{
    if (x % 400 == 0) return true;
    if (x % 100 == 0) return false;
    if (x % 4 == 0) return true;
    return false;
}

int main() {
    int max = 0, s = 0, day = 0;
    for (int i = 1; i <= 7; i++)
    {
        int a, b;
        scanf("%d %d", &a, &b);
        s = a + b;
        if (s > max && s > 8) max = s, day = i;
    }
    cout << day << endl;
    return 0;
}